﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:Bio.Views.Alignment.Controls" xmlns:julmar="clr-namespace:JulMar.Windows.Converters;assembly=JulMar.Wpf.Helpers" xmlns:Internal="clr-namespace:Bio.Views.Alignment.Internal">
    
    <Style TargetType="{x:Type Controls:SequenceBlock}">
        <Setter Property="BorderBrush" Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Controls:SequenceBlock}">
                    <Grid UseLayoutRounding="True">
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Background="{TemplateBinding Background}" VerticalAlignment="Center">
                            <Controls:SequenceTextDrawingVisualHost x:Name="PART_TextHost" VerticalAlignment="Center" />
                        </Border>
                        <Border x:Name="bd" BorderThickness="1" Visibility="Collapsed"
                                Width="{Binding CellWidth, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={julmar:MathConverter}, ConverterParameter=+2}" 
                                Height="{Binding CellHeight, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={julmar:MathConverter}, ConverterParameter=+2}" 
                                Background="{TemplateBinding FocusBackgroundBrush}"
                                BorderBrush="{TemplateBinding FocusBorderBrush}" HorizontalAlignment="Left" VerticalAlignment="Center">
                            <Border.RenderTransform>
                                <TranslateTransform Y="0" X="{Binding FocusRectangleOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
                            </Border.RenderTransform>
                            <TextBlock x:Name="tb" FontWeight="Bold" Text="{Binding FocusedSymbol.Text, RelativeSource={RelativeSource Mode=TemplatedParent}}" 
                                       Foreground="{TemplateBinding FocusedSymbolBrush}" HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="ShowFocusIndicator" Value="True" />
                                <Condition Property="IsActive" Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="bd" Property="Visibility" Value="Visible" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>        
    </Style>
    
</ResourceDictionary>